package cn.diancan.model.types;



public enum PurchaseSaleOrderType {

     
    PURCHASE	(1,"进货","PU"),
     
    INVENTORY	(2,"盘点","IN"),
    
    SALE	(3,"销售","SA"),
    
    RETURNGOODS	(4,"退货","RE"),
    
    EXCHANGEGOODS(5,"换货","EX"),
    
    GIFT	(6,"赠品","GI");
    
    
    private PurchaseSaleOrderType(Integer type,String typeName,String prefix){
	this.type = type; 
	this.typeName=typeName;
	this.prefix =prefix;
    }
    
    
    public static boolean checkExists(Integer type){
	if(null==type){
	    return false;
	}
	PurchaseSaleOrderType enums[] =PurchaseSaleOrderType.values();
	for (int i = 0; i < enums.length; i++) {
	    PurchaseSaleOrderType singleEnum=  enums[i]; 
	    if(singleEnum.getType().equals(type)){
		return true;
	    }
	}
	return false;
    }
    
    public static PurchaseSaleOrderType find(Integer type){
	if(null==type){
	    return null;
	}
	PurchaseSaleOrderType enums[] =PurchaseSaleOrderType.values();
	for (int i = 0; i < enums.length; i++) {
	    PurchaseSaleOrderType singleEnum=  enums[i]; 
	    if(singleEnum.getType().equals(type)){
		return singleEnum;
	    }
	}
	return null;
    }
    
    
    private Integer type;
    private String typeName;
    private String prefix;
    
    public Integer getType() {
        return type;
    }
    public String getTypeName() {
        return typeName;
    }


    public String getPrefix() {
        return prefix;
    }
    
    
}
